create grid
XgrCreateGrid ( @grid, gridType, x, y, w, h, window, parent, gridFunction )

creates a grid in window , positions its upper-left corner at x,y in the local coordinates of its parent, sets its local coordinates to 0,0:w-1,h-1 , and initializes its attributes to default values.

When grid is passed to graphics functions, operations are performed with the grid attributes.

get and set grid attributes
Functions XgrGet AttributeName () and XgrSet AttributeName () get and set the named grid attribute. These functions perform the action described by their name and arguments. For example:

XgrGetDrawingRGB ( exhaustManifold, @red, @green, @blue )
red=red+deltaRed : green=green+deltaGreen : blue=blue+deltaBlue
XgrSetDrawingRGB ( exhaustManifold, red, green, blue )
'
XgrGetGridBoxGrid ( grid, x1Grid, y1Grid, x2Grid, y2Grid )
XgrSetBackgroundColor ( grid, $$DarkBlue )

destroy grid
XgrDestroyGrid() discards grids when they are no longer needed. It is important to destroy grids when they are not longer needed, since since every grid consumes about 1KB of system memory. XgrDestroyGrid() frees grid numbers for reuse.

XgrDestroyWindow() destroys all the grids in the window and removes the window from the display.

XgrDestroyGrid ( grid ) ' destroy grid
XgrDestroyWindow ( window ) ' destroy window and all grids in window